<!--
Copyright Louis Dionne 2013-2017
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
-->
<!-- boost-no-inspect -->
<!-- HTML header for doxygen 1.8.9.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<title>Boost.Hana: boost::hana::integral_constant&lt; T, v &gt; Struct Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
// Copyright Louis Dionne 2013-2017
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
MathJax.Hub.Config({
    "HTML-CSS": {
        linebreaks: {
            automatic: true,
            width: "75% container"
        }
    }
});
</script>
<script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<!-- Additional javascript for drawing charts. -->
<script type="text/javascript" src="highcharts.js"></script>
<script type="text/javascript" src="highcharts-data.js"></script>
<script type="text/javascript" src="highcharts-exporting.js"></script>
<script type="text/javascript" src="chart.js"></script>
<script type="text/javascript" src="hana.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Boost.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Boost.Hana
   &#160;<span id="projectnumber">1.7.1</span>
   </div>
   <div id="projectbrief">Your standard library for metaprogramming</div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.svg"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('structboost_1_1hana_1_1integral__constant.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#related">Synopsis of associated functions</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="structboost_1_1hana_1_1integral__constant-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">boost::hana::integral_constant&lt; T, v &gt; Struct Template Reference<div class="ingroups"><a class="el" href="group__group-datatypes.html">Data types</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<div class="textblock"><h3>template&lt;typename T, T v&gt;<br />
struct boost::hana::integral_constant&lt; T, v &gt;</h3>

<p>Compile-time value of an integral type. </p>
<p>An <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code> is an object that represents a compile-time integral value. As the name suggests, <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">hana::integral_constant</a></code> is basically equivalent to <code><a class="el" href="structstd_1_1integral__constant.html" title="Adapter for std::integral_constants.">std::integral_constant</a></code>, except that <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">hana::integral_constant</a></code> also provide other goodies to make them easier to use, like arithmetic operators and similar features. In particular, <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">hana::integral_constant</a></code> is guaranteed to inherit from the corresponding <code><a class="el" href="structstd_1_1integral__constant.html" title="Adapter for std::integral_constants.">std::integral_constant</a></code>, and hence have the same members and capabilities. The sections below explain the extensions to <code><a class="el" href="structstd_1_1integral__constant.html" title="Adapter for std::integral_constants.">std::integral_constant</a></code> provided by <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">hana::integral_constant</a></code>.</p>
<h2><a class="anchor" id="autotoc_md0"></a>
Arithmetic operators</h2>
<p><code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">hana::integral_constant</a></code> provides arithmetic operators that return <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">hana::integral_constant</a></code>s to ease writing compile-time arithmetic: </p><div class="fragment"><div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::int_c&lt;1&gt; + hana::int_c&lt;3&gt; == hana::int_c&lt;4&gt;);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Mixed-type operations are supported, but only when it involves a</span></div>
<div class="line"><span class="comment">// promotion, and not a conversion that could be lossy.</span></div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::size_c&lt;3&gt; * hana::ushort_c&lt;5&gt; == hana::size_c&lt;15&gt;);</div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::llong_c&lt;15&gt; == hana::int_c&lt;15&gt;);</div>
<div class="ttc" id="agroup__group-assertions_html_ga2c5006540936d9f8880e3a39f4fcc035"><div class="ttname"><a href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a></div><div class="ttdeci">#define BOOST_HANA_CONSTANT_CHECK(...)</div><div class="ttdoc">Equivalent to BOOST_HANA_CONSTANT_ASSERT, but not influenced by the BOOST_HANA_CONFIG_DISABLE_ASSERTI...</div><div class="ttdef"><b>Definition:</b> assert.hpp:239</div></div>
</div><!-- fragment --><p> It is pretty important to realize that these operators return other <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>s, not normal values of an integral type. Actually, all those operators work pretty much in the same way. Simply put, for an operator <code>@</code>, </p><div class="fragment"><div class="line">integral_constant&lt;T, x&gt;{} @ integral_constant&lt;T, y&gt;{} == integral_constant&lt;T, x @ y&gt;{}</div>
</div><!-- fragment --><p>The fact that the operators return <code>Constant</code>s is very important because it allows all the information that's known at compile-time to be conserved as long as it's only used with other values known at compile-time. It is also interesting to observe that whenever an <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code> is combined with a normal runtime value, the result will be a runtime value (because of the implicit conversion). In general, this gives us the following table</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadCenter">left operand   </th><th class="markdownTableHeadCenter">right operand   </th><th class="markdownTableHeadCenter">result    </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyCenter"><code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>   </td><td class="markdownTableBodyCenter"><code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>   </td><td class="markdownTableBodyCenter"><code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyCenter"><code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>   </td><td class="markdownTableBodyCenter">runtime   </td><td class="markdownTableBodyCenter">runtime    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyCenter">runtime   </td><td class="markdownTableBodyCenter"><code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>   </td><td class="markdownTableBodyCenter">runtime    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyCenter">runtime   </td><td class="markdownTableBodyCenter">runtime   </td><td class="markdownTableBodyCenter">runtime   </td></tr>
</table>
<p>The full range of provided operators is</p><ul>
<li>Arithmetic: binary <code>+</code>, binary <code>-</code>, <code>/</code>, <code>*</code>, <code>%</code>, unary <code>+</code>, unary <code>-</code></li>
<li>Bitwise: <code>~</code>, <code>&amp;</code>, <code>|</code>, <code>^</code>, <code>&lt;&lt;</code>, <code>&gt;&gt;</code></li>
<li>Comparison: <code>==</code>, <code>!=</code>, <code>&lt;</code>, <code>&lt;=</code>, <code>&gt;</code>, <code>&gt;=</code></li>
<li>Logical: <code>||</code>, <code>&amp;&amp;</code>, <code>!</code></li>
</ul>
<h2><a class="anchor" id="autotoc_md1"></a>
Construction with user-defined literals</h2>
<p><code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>s of type <code>long long</code> can be created with the <code>_c</code> user-defined literal, which is contained in the <code>literals</code> namespace: </p><div class="fragment"><div class="line"><span class="keyword">using namespace </span>hana::literals; <span class="comment">// contains the _c suffix</span></div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(1234_c == hana::llong_c&lt;1234&gt;);</div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(-1234_c == hana::llong_c&lt;-1234&gt;);</div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(1_c + (3_c * 4_c) == hana::llong_c&lt;1 + (3 * 4)&gt;);</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md2"></a>
Modeled concepts</h2>
<ol type="1">
<li><code>Constant</code> and <code><a class="el" href="structboost_1_1hana_1_1_integral_constant.html" title="The IntegralConstant concept represents compile-time integral values.">IntegralConstant</a></code><br  />
An <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code> is a model of the <code><a class="el" href="structboost_1_1hana_1_1_integral_constant.html" title="The IntegralConstant concept represents compile-time integral values.">IntegralConstant</a></code> concept in the most obvious way possible. Specifically, <div class="fragment"><div class="line"><a class="code" href="group__group-_constant.html#ga1687520692a6b0c49e3a69de2980f388">integral_constant&lt;T, v&gt;::value</a> == v <span class="comment">// of type T</span></div>
<div class="ttc" id="agroup__group-_constant_html_ga1687520692a6b0c49e3a69de2980f388"><div class="ttname"><a href="group__group-_constant.html#ga1687520692a6b0c49e3a69de2980f388">boost::hana::value</a></div><div class="ttdeci">constexpr auto value</div><div class="ttdoc">Return the compile-time value associated to a constant.</div><div class="ttdef"><b>Definition:</b> value.hpp:54</div></div>
</div><!-- fragment --> The model of <code>Constant</code> follows naturally from the model of <code><a class="el" href="structboost_1_1hana_1_1_integral_constant.html" title="The IntegralConstant concept represents compile-time integral values.">IntegralConstant</a></code>, i.e. <div class="fragment"><div class="line">value&lt;integral_constant&lt;T, v&gt;&gt;() == v <span class="comment">// of type T</span></div>
</div><!-- fragment --></li>
<li><code>Comparable</code>, <code>Orderable</code>, <code>Logical</code>, <code>Monoid</code>, <code>Group</code>, <code>Ring</code>, and <code>EuclideanRing</code>, <code>Hashable</code><br  />
Those models are exactly those provided for <code>Constant</code>s, which are documented in their respective concepts. </li>
</ol>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="related"></a>
Synopsis of associated functions</h2></td></tr>
<tr class="memitem:a8e52c0f4a65a852dc88f97259a05ff17"><td class="memTemplParams" colspan="2">template&lt;typename T , T v&gt; </td></tr>
<tr class="memitem:a8e52c0f4a65a852dc88f97259a05ff17"><td class="memTemplItemLeft" align="right" valign="top">constexpr <a class="el" href="structboost_1_1hana_1_1integral__constant.html">integral_constant</a>&lt; T, v &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a8e52c0f4a65a852dc88f97259a05ff17">integral_c</a> {}</td></tr>
<tr class="memdesc:a8e52c0f4a65a852dc88f97259a05ff17"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates an <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code> holding the given compile-time value.  <a href="structboost_1_1hana_1_1integral__constant.html#a8e52c0f4a65a852dc88f97259a05ff17">More...</a><br /></td></tr>
<tr class="separator:a8e52c0f4a65a852dc88f97259a05ff17"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1c078fd00db48686ca9e0aa17f47344e"><td class="memTemplParams" colspan="2">template&lt;char ... c&gt; </td></tr>
<tr class="memitem:a1c078fd00db48686ca9e0aa17f47344e"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a1c078fd00db48686ca9e0aa17f47344e">operator&quot;&quot;_c</a> ()</td></tr>
<tr class="memdesc:a1c078fd00db48686ca9e0aa17f47344e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">hana::integral_constant</a></code> from a literal.  <a href="structboost_1_1hana_1_1integral__constant.html#a1c078fd00db48686ca9e0aa17f47344e">More...</a><br /></td></tr>
<tr class="separator:a1c078fd00db48686ca9e0aa17f47344e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:a897cb2a15eeef6924a2b2fda36eac874"><td class="memTemplParams" colspan="2"><a id="a897cb2a15eeef6924a2b2fda36eac874"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a897cb2a15eeef6924a2b2fda36eac874"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a897cb2a15eeef6924a2b2fda36eac874">operator+</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a897cb2a15eeef6924a2b2fda36eac874"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_monoid.html#gaeb5d4a1e967e319712f9e4791948896c" title="Associative binary operation on a Monoid.">hana::plus</a></code> <br /></td></tr>
<tr class="separator:a897cb2a15eeef6924a2b2fda36eac874"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7217b8e64dd43d969faca2c727db08b3"><td class="memTemplParams" colspan="2"><a id="a7217b8e64dd43d969faca2c727db08b3"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a7217b8e64dd43d969faca2c727db08b3"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a7217b8e64dd43d969faca2c727db08b3">operator-</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a7217b8e64dd43d969faca2c727db08b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_group.html#ga2020c526324f361a2b990fe8d1b07c20" title="Subtract two elements of a group.">hana::minus</a></code> <br /></td></tr>
<tr class="separator:a7217b8e64dd43d969faca2c727db08b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8a38703ec26537f474a9f0a5953ac582"><td class="memTemplParams" colspan="2"><a id="a8a38703ec26537f474a9f0a5953ac582"></a>
template&lt;typename X &gt; </td></tr>
<tr class="memitem:a8a38703ec26537f474a9f0a5953ac582"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a8a38703ec26537f474a9f0a5953ac582">operator-</a> (X &amp;&amp;x)</td></tr>
<tr class="memdesc:a8a38703ec26537f474a9f0a5953ac582"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_group.html#ga02e81002f40ba52eac4cf1974c7e0cdb" title="Return the inverse of an element of a group.">hana::negate</a></code> <br /></td></tr>
<tr class="separator:a8a38703ec26537f474a9f0a5953ac582"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1495dcab0ecb2627ce1e834afe98f8d6"><td class="memTemplParams" colspan="2"><a id="a1495dcab0ecb2627ce1e834afe98f8d6"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a1495dcab0ecb2627ce1e834afe98f8d6"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a1495dcab0ecb2627ce1e834afe98f8d6">operator*</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a1495dcab0ecb2627ce1e834afe98f8d6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_ring.html#ga052d31c269a6a438cc8004c9ad1efdfa" title="Associative operation of a Ring.">hana::mult</a></code> <br /></td></tr>
<tr class="separator:a1495dcab0ecb2627ce1e834afe98f8d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7191ce0909ad60058d4fbf8f1d3ef235"><td class="memTemplParams" colspan="2"><a id="a7191ce0909ad60058d4fbf8f1d3ef235"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a7191ce0909ad60058d4fbf8f1d3ef235"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a7191ce0909ad60058d4fbf8f1d3ef235">operator/</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a7191ce0909ad60058d4fbf8f1d3ef235"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_euclidean_ring.html#ga4225a7988ce98903228913dde53762df" title="Generalized integer division.">hana::div</a></code> <br /></td></tr>
<tr class="separator:a7191ce0909ad60058d4fbf8f1d3ef235"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abae3f5f4393987734db5b7a638735918"><td class="memTemplParams" colspan="2"><a id="abae3f5f4393987734db5b7a638735918"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:abae3f5f4393987734db5b7a638735918"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#abae3f5f4393987734db5b7a638735918">operator%</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:abae3f5f4393987734db5b7a638735918"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_euclidean_ring.html#ga9b47b223d5b02db933b3c93b5bd1a062" title="Generalized integer modulus.">hana::mod</a></code> <br /></td></tr>
<tr class="separator:abae3f5f4393987734db5b7a638735918"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a22bef1b2c14cf393a3a9cb1924d8c8ff"><td class="memTemplParams" colspan="2"><a id="a22bef1b2c14cf393a3a9cb1924d8c8ff"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a22bef1b2c14cf393a3a9cb1924d8c8ff"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a22bef1b2c14cf393a3a9cb1924d8c8ff">operator==</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a22bef1b2c14cf393a3a9cb1924d8c8ff"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_comparable.html#gacaf1ebea6b3ab96ac9dcb82f0e64e547" title="Returns a Logical representing whether x is equal to y.">hana::equal</a></code> <br /></td></tr>
<tr class="separator:a22bef1b2c14cf393a3a9cb1924d8c8ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ecea0deb4c00ae2eb0b0713ee0645e9"><td class="memTemplParams" colspan="2"><a id="a4ecea0deb4c00ae2eb0b0713ee0645e9"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a4ecea0deb4c00ae2eb0b0713ee0645e9"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a4ecea0deb4c00ae2eb0b0713ee0645e9">operator!=</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a4ecea0deb4c00ae2eb0b0713ee0645e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_comparable.html#gae33be2e0d5e04f19082f4b7740dfc9cd" title="Returns a Logical representing whether x is not equal to y.">hana::not_equal</a></code> <br /></td></tr>
<tr class="separator:a4ecea0deb4c00ae2eb0b0713ee0645e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acac20f8a52750bae122668729ec4df36"><td class="memTemplParams" colspan="2"><a id="acac20f8a52750bae122668729ec4df36"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:acac20f8a52750bae122668729ec4df36"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#acac20f8a52750bae122668729ec4df36">operator||</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:acac20f8a52750bae122668729ec4df36"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_logical.html#ga68c00efbeb69339bfa157a78ebdd3f87" title="Return whether any of the arguments is true-valued.">hana::or_</a></code> <br /></td></tr>
<tr class="separator:acac20f8a52750bae122668729ec4df36"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a69ba502677100036ab9e7101e91ca28f"><td class="memTemplParams" colspan="2"><a id="a69ba502677100036ab9e7101e91ca28f"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a69ba502677100036ab9e7101e91ca28f"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a69ba502677100036ab9e7101e91ca28f">operator&amp;&amp;</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a69ba502677100036ab9e7101e91ca28f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_logical.html#ga14066f5672867c123524e0e0978069eb" title="Return whether all the arguments are true-valued.">hana::and_</a></code> <br /></td></tr>
<tr class="separator:a69ba502677100036ab9e7101e91ca28f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8edb19203d27b84512479602eeeb8fe3"><td class="memTemplParams" colspan="2"><a id="a8edb19203d27b84512479602eeeb8fe3"></a>
template&lt;typename X &gt; </td></tr>
<tr class="memitem:a8edb19203d27b84512479602eeeb8fe3"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a8edb19203d27b84512479602eeeb8fe3">operator!</a> (X &amp;&amp;x)</td></tr>
<tr class="memdesc:a8edb19203d27b84512479602eeeb8fe3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_logical.html#ga4a7c9d7037601d5e553fd20777958980" title="Negates a Logical.">hana::not_</a></code> <br /></td></tr>
<tr class="separator:a8edb19203d27b84512479602eeeb8fe3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aca31ad50b2d35d48aac88aa762530c75"><td class="memTemplParams" colspan="2"><a id="aca31ad50b2d35d48aac88aa762530c75"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:aca31ad50b2d35d48aac88aa762530c75"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#aca31ad50b2d35d48aac88aa762530c75">operator&lt;</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:aca31ad50b2d35d48aac88aa762530c75"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_orderable.html#gad510011602bdb14686f1c4ec145301c9" title="Returns a Logical representing whether x is less than y.">hana::less</a></code> <br /></td></tr>
<tr class="separator:aca31ad50b2d35d48aac88aa762530c75"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a65b9400772e651101ae83d7f9f7ba84d"><td class="memTemplParams" colspan="2"><a id="a65b9400772e651101ae83d7f9f7ba84d"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a65b9400772e651101ae83d7f9f7ba84d"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a65b9400772e651101ae83d7f9f7ba84d">operator&gt;</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a65b9400772e651101ae83d7f9f7ba84d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_orderable.html#gaf9a073eafebbe514fb19dff82318f198" title="Returns a Logical representing whether x is greater than y.">hana::greater</a></code> <br /></td></tr>
<tr class="separator:a65b9400772e651101ae83d7f9f7ba84d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a971bac762b767fe0ec222adb367c9aeb"><td class="memTemplParams" colspan="2"><a id="a971bac762b767fe0ec222adb367c9aeb"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a971bac762b767fe0ec222adb367c9aeb"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a971bac762b767fe0ec222adb367c9aeb">operator&lt;=</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a971bac762b767fe0ec222adb367c9aeb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_orderable.html#ga9917dd82beb67151bf5657245d37b851" title="Returns a Logical representing whether x is less than or equal to y.">hana::less_equal</a></code> <br /></td></tr>
<tr class="separator:a971bac762b767fe0ec222adb367c9aeb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adec95a8109b858673412671ba341611b"><td class="memTemplParams" colspan="2"><a id="adec95a8109b858673412671ba341611b"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:adec95a8109b858673412671ba341611b"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#adec95a8109b858673412671ba341611b">operator&gt;=</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:adec95a8109b858673412671ba341611b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_orderable.html#ga6023631e7d0a01e16dc3fa4221fbd703" title="Returns a Logical representing whether x is greater than or equal to y.">hana::greater_equal</a></code> <br /></td></tr>
<tr class="separator:adec95a8109b858673412671ba341611b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a2d4bda4a9114a5e803a91def599fae76"><td class="memTemplParams" colspan="2">template&lt;typename F &gt; </td></tr>
<tr class="memitem:a2d4bda4a9114a5e803a91def599fae76"><td class="memTemplItemLeft" align="right" valign="top">static constexpr void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1integral__constant.html#a2d4bda4a9114a5e803a91def599fae76">times</a> (F &amp;&amp;f)</td></tr>
<tr class="memdesc:a2d4bda4a9114a5e803a91def599fae76"><td class="mdescLeft">&#160;</td><td class="mdescRight">Call a function n times.  <a href="structboost_1_1hana_1_1integral__constant.html#a2d4bda4a9114a5e803a91def599fae76">More...</a><br /></td></tr>
<tr class="separator:a2d4bda4a9114a5e803a91def599fae76"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Associated functions</h2>
<a id="a8e52c0f4a65a852dc88f97259a05ff17"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8e52c0f4a65a852dc88f97259a05ff17">&#9670;&nbsp;</a></span>integral_c</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , T v&gt; </div>
<div class="memtemplate">
template&lt;typename T , T v&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">constexpr <a class="el" href="structboost_1_1hana_1_1integral__constant.html">integral_constant</a>&lt;T, v&gt; integral_c {}</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Creates an <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code> holding the given compile-time value. </p>
<p>Specifically, <code>integral_c&lt;T, v&gt;</code> is a <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">hana::integral_constant</a></code> holding the compile-time value <code>v</code> of an integral type <code>T</code>.</p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td>The type of the value to hold in the <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>. It must be an integral type.</td></tr>
    <tr><td class="paramname">v</td><td>The integral value to hold in the <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>.</td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="autotoc_md242"></a>
Example</h2>
<div class="fragment"><div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::integral_c&lt;int, 2&gt; == hana::int_c&lt;2&gt;);</div>
<div class="line">static_assert(decltype(hana::integral_c&lt;int, 2&gt;)::<a class="code" href="group__group-_constant.html#ga1687520692a6b0c49e3a69de2980f388">value</a> == 2, <span class="stringliteral">&quot;&quot;</span>);</div>
</div><!-- fragment -->
</div>
</div>
<a id="a1c078fd00db48686ca9e0aa17f47344e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1c078fd00db48686ca9e0aa17f47344e">&#9670;&nbsp;</a></span>operator&quot;&quot;_c()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;char ... c&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">constexpr auto operator&quot;&quot;_c </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Creates a <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">hana::integral_constant</a></code> from a literal. </p>
<p>The literal is parsed at compile-time and the result is returned as a <code>llong&lt;...&gt;</code>.</p>
<dl class="section note"><dt>Note</dt><dd>We use <code>llong&lt;...&gt;</code> instead of <code>ullong&lt;...&gt;</code> because using an unsigned type leads to unexpected behavior when doing stuff like <code>-1_c</code>. If we used an unsigned type, <code>-1_c</code> would be something like <code>ullong&lt;-1&gt;</code> which is actually <code>ullong&lt;something huge&gt;</code>.</dd></dl>
<h2><a class="anchor" id="autotoc_md243"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="keyword">using namespace </span>hana::literals; <span class="comment">// contains the _c suffix</span></div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(1234_c == hana::llong_c&lt;1234&gt;);</div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(-1234_c == hana::llong_c&lt;-1234&gt;);</div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(1_c + (3_c * 4_c) == hana::llong_c&lt;1 + (3 * 4)&gt;);</div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a2d4bda4a9114a5e803a91def599fae76"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2d4bda4a9114a5e803a91def599fae76">&#9670;&nbsp;</a></span>times()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , T v&gt; </div>
<div class="memtemplate">
template&lt;typename F &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static constexpr void <a class="el" href="structboost_1_1hana_1_1integral__constant.html">boost::hana::integral_constant</a>&lt; T, v &gt;::times </td>
          <td>(</td>
          <td class="paramtype">F &amp;&amp;&#160;</td>
          <td class="paramname"><em>f</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span><span class="mlabel">constexpr</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Call a function n times. </p>
<p><code>times</code> allows a nullary function to be invoked <code>n</code> times: </p><div class="fragment"><div class="line"><a class="code" href="structboost_1_1hana_1_1integral__constant.html#a2d4bda4a9114a5e803a91def599fae76">int_&lt;3&gt;::times</a>(f)</div>
<div class="ttc" id="astructboost_1_1hana_1_1integral__constant_html_a2d4bda4a9114a5e803a91def599fae76"><div class="ttname"><a href="structboost_1_1hana_1_1integral__constant.html#a2d4bda4a9114a5e803a91def599fae76">boost::hana::integral_constant::times</a></div><div class="ttdeci">static constexpr void times(F &amp;&amp;f)</div><div class="ttdoc">Call a function n times.</div><div class="ttdef"><b>Definition:</b> integral_constant.hpp:168</div></div>
</div><!-- fragment --><p> should be expanded by any decent compiler to </p><div class="fragment"><div class="line">f(); f(); f();</div>
</div><!-- fragment --><p>This can be useful in several contexts, e.g. for loop unrolling: </p><div class="fragment"><div class="line">std::string s;</div>
<div class="line"><span class="keywordflow">for</span> (<span class="keywordtype">char</span> c = <span class="charliteral">&#39;x&#39;</span>; c &lt;= <span class="charliteral">&#39;z&#39;</span>; ++c)</div>
<div class="line">    hana::int_&lt;5&gt;::times([&amp;] { s += c; });</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(s == <span class="stringliteral">&quot;xxxxxyyyyyzzzzz&quot;</span>);</div>
<div class="ttc" id="agroup__group-assertions_html_ga4796ae107d58b67e0bbccd5ae6f70101"><div class="ttname"><a href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a></div><div class="ttdeci">#define BOOST_HANA_RUNTIME_CHECK(...)</div><div class="ttdoc">Equivalent to BOOST_HANA_RUNTIME_ASSERT, but not influenced by the BOOST_HANA_CONFIG_DISABLE_ASSERTIO...</div><div class="ttdef"><b>Definition:</b> assert.hpp:209</div></div>
</div><!-- fragment --><p> Note that <code>times</code> is really a static function object, not just a static function. This allows <code>int_&lt;n&gt;::times</code> to be passed to higher-order algorithms: </p><div class="fragment"><div class="line">std::string s;</div>
<div class="line"><span class="keyword">auto</span> functions = hana::make_tuple(</div>
<div class="line">    [&amp;] { s += <span class="stringliteral">&quot;x&quot;</span>; },</div>
<div class="line">    [&amp;] { s += <span class="stringliteral">&quot;y&quot;</span>; },</div>
<div class="line">    [&amp;] { s += <span class="stringliteral">&quot;z&quot;</span>; }</div>
<div class="line">);</div>
<div class="line"><a class="code" href="group__group-_foldable.html#ga2af382f7e644ce3707710bbad313e9c2">hana::for_each</a>(functions, hana::int_&lt;5&gt;::times);</div>
<div class="line"><a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(s == <span class="stringliteral">&quot;xxxxxyyyyyzzzzz&quot;</span>);</div>
<div class="ttc" id="agroup__group-_foldable_html_ga2af382f7e644ce3707710bbad313e9c2"><div class="ttname"><a href="group__group-_foldable.html#ga2af382f7e644ce3707710bbad313e9c2">boost::hana::for_each</a></div><div class="ttdeci">constexpr auto for_each</div><div class="ttdoc">Perform an action on each element of a foldable, discarding the result each time.</div><div class="ttdef"><b>Definition:</b> for_each.hpp:39</div></div>
</div><!-- fragment --><p> Also, since static members can be accessed using both the <code>.</code> and the <code>::</code> syntax, one can take advantage of this (loophole?) to call <code>times</code> on objects just as well as on types: </p><div class="fragment"><div class="line">std::string s;</div>
<div class="line"><span class="keywordflow">for</span> (<span class="keywordtype">char</span> c = <span class="charliteral">&#39;x&#39;</span>; c &lt;= <span class="charliteral">&#39;z&#39;</span>; ++c)</div>
<div class="line">    hana::int_c&lt;5&gt;.<a class="code" href="structboost_1_1hana_1_1integral__constant.html#a2d4bda4a9114a5e803a91def599fae76">times</a>([&amp;] { s += c; });</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(s == <span class="stringliteral">&quot;xxxxxyyyyyzzzzz&quot;</span>);</div>
</div><!-- fragment --> <dl class="section note"><dt>Note</dt><dd><code>times</code> is equivalent to the <code><a class="el" href="namespaceboost_1_1hana.html#a405f3dd84fc6f5003e64f8da104a1b54" title="Invokes a nullary function n times.">hana::repeat</a></code> function, which works on an arbitrary <code><a class="el" href="structboost_1_1hana_1_1_integral_constant.html" title="The IntegralConstant concept represents compile-time integral values.">IntegralConstant</a></code>.</dd></dl>
<p>Sometimes, it is also useful to know the index we're at inside the function. This can be achieved by using <code>times.with_index</code>: </p><div class="fragment"><div class="line">std::vector&lt;int&gt; v;</div>
<div class="line">hana::int_&lt;5&gt;::times.with_index([&amp;](<span class="keyword">auto</span> index) { v.push_back(index); });</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(v == std::vector&lt;int&gt;{0, 1, 2, 3, 4});</div>
</div><!-- fragment --><p> Remember that <code>times</code> is a <em>function object</em>, and hence it can have subobjects. <code>with_index</code> is just a function object nested inside <code>times</code>, which allows for this nice little interface. Also note that the indices passed to the function are <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>s; they are known at compile-time. Hence, we can do compile-time stuff with them, like indexing inside a tuple: </p><div class="fragment"><div class="line">constexpr <span class="keyword">auto</span> xs = hana::tuple_c&lt;int, 0, 1, 2&gt;;</div>
<div class="line">hana::int_&lt;3&gt;::times.with_index([xs](<span class="keyword">auto</span> index) {</div>
<div class="line">    <a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(xs[index] == index);</div>
<div class="line">});</div>
</div><!-- fragment --> <dl class="section note"><dt>Note</dt><dd><code>times.with_index(f)</code> guarantees that the calls to <code>f</code> will be done in order of ascending index. In other words, <code>f</code> will be called as <code>f(0)</code>, <code>f(1)</code>, <code>f(2)</code>, etc., but with <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>s instead of normal integers. Side effects can also be done in the function passed to <code>times</code> and <code>times.with_index</code>. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!--
Copyright Louis Dionne 2013-2017
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
-->
<!-- boost-no-inspect -->
<!-- HTML footer for doxygen 1.8.9.1-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>boost</b></li><li class="navelem"><a class="el" href="namespaceboost_1_1hana.html">hana</a></li><li class="navelem"><a class="el" href="structboost_1_1hana_1_1integral__constant.html">integral_constant</a></li>
  </ul>
</div>
</body>
</html>
